<?php
class Api_Calls_User extends Api_Calls
{
	static $_userCache = array();
	
	/**
	 * 
	 * returns all informations of the user
	 * @param int $userId
	 */
	public static function getUserDetails($userId = 0)
	{
                if (isset(self::$_userCache[$userid]))
                {
                	$user = self::$_usercache[$userid];
                }
                else
                {
                    $userModel = self::getModelFromCache('XenForo_Model_User');
                    $user = $userModel->getFullUserById($userid);

                    if ($user['gravatar'])
                    {
                    	$avatarUrl = 'http://www.gravatar.com/avatar/' . md5($user['gravatar']) . '.jpg?s=96'
                    }
                    else if (!empty($user['avatar_date']))
                    {
                    	$avatarUrl = XenForo_Application::$externalDataPath . '/avatars/m/' . floor($user['user_id'] / 1000) . '/' . $user['user_id'] . '.jpg?' . $user['avatar_date']));
                    }
                    else
                    {
                    	$avatarUrl = '';
                    }
                    $user['avatar_url'] = $avatarUrl;
                   
                    
                	self::$_usercache[$userid] = $user;
                }
                
                return $user;
	}
	
	
	public static function updateUserStatus($userid, $newStatus)
	{
		
	}
	
	
	public static function getOnlineUsers($showAll = false)
	{
		
	}
}